import { useNavigate, useSearchParams } from 'react-router-dom'
import { NavBar } from 'antd-mobile'
import styles from '../css/query.module.css'

function Header() {
  const nav = useNavigate()
  // 需要从路由的 URL 查询参数中，获取数据
  const [sp] = useSearchParams()

  return (
    <div className={styles.titleTop}>
      <NavBar onBack={() => nav(-1)}>
        {sp.get('start')} → {sp.get('end')}
      </NavBar>
    </div>
  )
}

export default Header
